import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/custmoer',
    name: 'custmoer',
    component: () => import('../views/custmoer.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/smslogin',
    name: 'smslogin',
    component: () => import('../views/smslogin.vue')
  },
  {
    path: '/setpassword',
    name: 'setpassword',
    component: () => import('../views/setpassword.vue')
  },
  {
    path: '/course',
    name: 'course',
    component: () => import('../views/course.vue')
  },
  {
    path: '/record',
    name: 'record',
    component: () => import('../views/record.vue')
  },
  {
    path: '/practice',
    name: 'practice',
    component: () => import('../views/practice.vue')
  },
  {
    path: '/my',
    name: 'my',
    component: () => import('../views/my.vue')
  },
  {
    path: '/info',
    name: 'info',
    component: () => import('../components/info.vue')
  },
  {
    path: '/calendar',
    name: 'calendar',
    component: () => import('../views/calendar.vue')
  },
  {
    path: '/teacherDetails',
    name: 'teacherDetails',
    component: () => import('../components/teacherDetails.vue')
  },
  {
    path: '/guanzhu',
    name: 'guanzhu',
    component: () => import('../components/guanzhu.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/search.vue')
  },
  {
    path: '/erweima',
    name: 'erweima',
    component: () => import('../views/erweima.vue')
  },
]

const originalPush= VueRouter.prototype.push
// 重写push函数
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  routes
})

export default router
